package com.company.project.common.utils;

import io.netty.handler.codec.DecoderException;
import org.apache.tomcat.util.codec.binary.Base64;

import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.FileImageOutputStream;
import java.io.*;
import java.sql.Blob;
import java.sql.SQLException;

public class ImageUtils {

    public static byte[] image2byte(String path) {
        byte[] data = null;
        FileImageInputStream input = null;
        try {
            input = new FileImageInputStream(new File(path));
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            byte[] buf = new byte[1024];
            int numBytesRead = 0;
            while ((numBytesRead = input.read(buf)) != -1) {
                output.write(buf, 0, numBytesRead);
            }
            data = output.toByteArray();
            output.close();
            input.close();
        } catch (FileNotFoundException ex1) {
            ex1.printStackTrace();
        } catch (IOException ex1) {
            ex1.printStackTrace();
        }
        return data;
    }

    public static void byte2image(byte[] data, String path) {
        if (data.length < 3 || path.equals("")) return;
        try {
            FileImageOutputStream imageOutput = new FileImageOutputStream(new File(path));
            imageOutput.write(data, 0, data.length);
            imageOutput.close();
            System.out.println("Make Picture success,Please find image in " + path);
        } catch (Exception ex) {
            System.out.println("Exception: " + ex);
            ex.printStackTrace();
        }
    }


    public static byte[] hexStringToByte(String hex) {
        int len = (hex.length() / 2);
        byte[] result = new byte[len];
        char[] achar = hex.toCharArray();
        for (int i = 0; i < len; i++) {
            int pos = i * 2;
            result[i] = (byte) (toByte(achar[pos]) << 4 | toByte(achar[pos + 1]));
        }
        return result;
    }

    private static int toByte(char c) {
        byte b = (byte) "0123456789ABCDEF".indexOf(c);
        return b;
    }


    public static String bytesToHex(byte[] bytes) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            String hex = Integer.toHexString(bytes[i] & 0xFF);
            if (hex.length() < 2) {
                sb.append(0);
            }
            sb.append(hex);
        }
        return sb.toString();
    }

    public static byte[] hexDecode(String hexStr) {
        if (hexStr == null || "".equals(hexStr)) {
            return null;
        }
        if(hexStr.startsWith("0x")){
            hexStr= hexStr.replaceFirst("0x", "");
        }
        try {
            char[] cs = hexStr.toCharArray();
            return Hex.decodeHex(cs);
        } catch (DecoderException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static String blobToBase64(Blob blob) {
        String result = "";
        if (null != blob) {
            try {
                InputStream msgContent = blob.getBinaryStream();
                ByteArrayOutputStream output = new ByteArrayOutputStream();
                byte[] buffer = new byte[100];
                int n = 0;
                while (-1 != (n = msgContent.read(buffer))) {
                    output.write(buffer, 0, n);
                }
                result = Base64.encodeBase64String(output.toByteArray());
                output.close();
            } catch (SQLException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return result;
        } else {
            return null;
        }
    }
    public static void main(String[] args) {
//        String image16ByteString = "0xFFD8FFE000104A46494600010101006000600000FFDB004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C180D0D1832211C213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232FFC0001108007E006603012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F7EA28A2800AAD7FA85A6996725DDEDC470411A96679180000A835BD6EC3C3DA54DA8EA33AC56F12E493D49F403B9AF947E227C41BEF1AEA9BD99E1B0889F22DF3C2FB9F563FA7E7904DD8F41F19FC7791E696D3C36BB6DB6E3ED52290CDFEE8EABF5EB5C3C5F177C45E6067BB9DFD9EE6423F2CD79DB485A9A0D1725DD9EEFE15F8CD771DD84D4AE0B42400779DDB7E99AEDB53F8B9A7C11FFA14A256600A92A00E7F1AF9489CD3FCE731AA9638518028049A47D2707C68786E163BB16EE7B88FA7E62BD37C3BE26D37C4FA7FDAB4E9D6400ED913F890FA115F0FC5298FEEF5AEB3C1FE34D47C2BAAA5F58BF39025898FCB2AFA1F7F43DBF3140EF63ECCA2B3741D6ACFC43A35BEA7632AC90CCB9CAF63DC7E06B4A82828A28A00291DD63467638551927D052D72BF11B543A4781353B85DE1DE3F290A1C10CDC03401E03F157C7B278AB5A3040BB74FB3664886EFF587382E7B7D3D8FBE2BCC2462C79ED5A57244809CE4D66C808A1904549D29734948A0A334514C6029E18E78A653928133DCBE0578C9AC2F7FE11FBB907D9AE98B42589CABE3A7A00793F9F5CD7D135F0E693753D95D43716EDB6689C3A1F420E457DA3E1ED49758F0F69FA8A8602E2057C375E477A011A545145030AF32F8E3A9FD8BC131DAECCFDAEE15339E9B7E6FE95E9B5E45FB402EEF0D695ED76DFF00A01A04CF9D24E2AA4ABBAADFDFCFB569E9BA1CB7C0384CA1EF43624AE73F15B1978032719AB116953CE3F769C7A9AEF6D3C24421D917CE4800E3B57496FE134B78628C2F419638EA6B37336503CA61D0A462DB90FCB8CFE3FF00EAAAF79A53C171E505E704D7B15C68216458D57E691C13F419359B79E1DF37596629F22C6E338EF494C6E07913DB327514C1F29AF437F0C870772718F4AE5B57D19EC5B3B30B54A466E253B67E95F637C3BFF9279A0FFD79A57C6B6C4AB006BEC1F85F1DCC7F0EB4817326F2610C87D13B0FC2A8948EBE8A28A630AF31F8E3A6CD7BE0FB7B8880296B71B9C77C302A31F89AF4EAA1ADE9D1EADA25E584ABB92789971F85027B1F17D959C97174B0AAE59D86457B168FA10B2D3E28D170E47231DEB8FD034C10F8C0C2EA4084BA9CFF00781C7F3AF53633C43CC8D3711DAB19CB535A71D3528AC7796AA36DB2B7A124D5DB679E5C199369F4CD63EB3ACF8861B66920B58F83F246724FF318ABFA4DCEA13BA7DA63043F20F4E3B64738FCEB1BDCDD268D36B546944BFC4062B32F6DA6695BC95C96AE99EDF6C678E6B9DBF7D416692383E4DA8CCAC39C90381F8D34EC0CCE8B47BC2AC6545C03C73587E26F0F0B8D3646D9975191C56DE917FE26B9B553796E91B16C3293838FCCFBD6BDD4323DB48B20E581069F358871B9F3ED8E9D25D5EC56B1266691C22FD49C57D9BA169EBA4E836360B9C410AA73F4AF9BFC35A0A3FC4CB2B5666588DD0231EC377F315F5056F077573192B3B051451564851451401E3FACF855348F14CD3C64B24C4CAA48FEF1C919FAD6CD9A960056FF008C6D5DA182E97958F2ADED9EF5CD595D042326B92A2B4AC755377572FCB6AA58E475A8E248ED9CE0E09E6A3BCD4C448D20E400703DEB2F4CBF92E51E7BC5232DF2803381528B6742D36EE4D40C91CADC9C9A87ED96E50E0923E959D7D753C12413DA8668C9C3AB71807BD377046DC36EA0822ABEA4836B0A7C37E8DCA9E2ABDEDC0958806A4A2C784FC256735EC7AE48A5678652D191FC5C60FF005AF41AC8F0D40D0687006C7CD9718F426B5EBB20AD14714DDE4C28A28AA2428A2A9EA7AAD968F6525DDF4EB14283249EA7E83B9A005D52D45EE9B3C07196438246707D6BCBE485E09CC6C3054E0D50D5BE374F737AD63A2D944A1E4091CF3924919C64AF6FCFFC29D16AD7378CD35E94F39CE4EC181F976AE7AAD33A692696A4F7923C70962A4A83DB9A8ADF5B816131C90CC09EC2338AB51DC2C802B1ABC622F165064E6B28B3632D757B24E7C9947D2335349A9A5C407C9490AE7F8908ABCB64C4F22A63088A320F4AA9058CEB650D0EE45C0AB16B6B25DDEC50A8397600E3AE3BD40D3AC03621F96A3B1F1CE91A06B31AEA1E68DCA46F54C815114DB149A516CF598625821489000A8000053EB02C3C6BE1FD4628A487518D7CD2022C9F296FA035BC0860082083D08AEE3845A28A2803CFB52F1CDDCA5E5B15486C972BE63AE5DCF6C0FF00F5D709AEDDDE6A31BDC5EBC933CC331439DDC74E9DABA0B945BD06FAE17CAD3A1C7D9E23FC47A8E0FB8AC73F68901995775E5CF118FF009E6B9E6B9DC9DCEF85356D11E373F9FA6F8917CC8BCB78664674CF41906BD842AC9124A873BB041F6AF39F1EE8B2699AE418983DC4E313FCC301B20019F4E05775E08B95D53C3B036EDD242046DEC714A4AEAE63F0C9A353E78CE40AD3B3D51A28F0C714C36DC61AA092CD6B2354CD43AD2FF7EA8DE6AEF282919249AACB6311FBD5623B38E3E5681B652559A44DCE483E95E6DF106E0A6A16F12B156087763EB5EAD77225B5A4B3B90AA8A4927A57846AF7973ACF88A6936B3891F117FBB9E31FAD6B056D4C26EEEC77BE138ADED7408B51BD2659B1FE8F09190473F91C8AF42D2FC59AF692167BD58BEC8E40480B6E61E8063A7EB5C8689A2C7A669B0DD6A927CE883C983AFE7DC1CD69C16525C58A6A9A85FBA31C490C2083C8E9EE39157CFA94A8DD1EA7A7F8C6C2F10B4D1CB6C31906453CFE039A2BCF122F3ED22BBD4F56963799432471B7DD04679E68A3DB23374B5D8D3B887FB72FFCB51FF12EB32484ECCC3902A210AE95E6487F79A8CB908BD7CB0782011DABA38ADE1D234D78E3076C209C81F79BAE4D50B3B645D21FC4371F3DC3AE500FE1C8E9FA54B83B799D519A76B6C79C78CFC3CAFA394311B8D626C48D81929EAA31D7B572BF0EF59FECBD4C59162B0CC0F9B9E30FC62BD8D54C7A54BAEC8AAF753282BFECAB0E95E25E25B29744BE86F15A3617C7ED2A00E5083D338CD24FDD57EA2A94DCA4DAE87B84884E0E383517939EB54BC1FAA1D73C3D6F712EEF342287CF4CFB574296E8D59B46699962DE3CE3073F4A7989514F615A86DD17A5729E32D65B47D2E530C61A46F9412718CF19A121C99C5FC41F1219A36D12CA4552C84CCDBB1D3B7E3589E07B68E2B6FED2BB8CCB327EEED6361D067391F8FF003AE6254FB76AE9E6C8CEF2B02E5877CD7B269DA5C1A46970DD15134C8A020603083DAB46ED01D2A69CB9A458B7D3CDC7FC4D35C94F3F3A4248E7EBDFB52DB5BDA5CAB6A9A8C812DD77082D80C86F7F6E68B3B6975E9E4BCBE9D9A18CF31F5C9EA3F0A74115BDE5DDDCF7117EE2CE4114702FDDE991D7D2B14EE74CE3CAECF726B08748BA8CDF6A6A374E498A271C220E063F2A2AC68D696DAF5D5ECD796F1B2C2C238A3C7CA8319E28AD55EDA23272B3B5CFFFD9";
//        byte[] imagebyte = hexStringToByte(image16ByteString);
//        System.out.println(encoder.encode(imagebyte));


//        byte[] imagebytes = image2byte("D:\\2020071007352997926.jpg");
//        String imageString = bytesToHex(imagebytes);
//        System.out.println(imageString);

        byte[] bytes = hexDecode("0xFFD8FFE000104A46494600010100000100010000FFDB0043000302020302020303030304030304050805050404050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B1016101113141515150C0F171816141812141514FFDB00430103040405040509050509140D0B0D1414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414FFC0001108007E006603012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00FD50A28A2A0028A2BC7FF682FDA3B45F815A0BDC4E9F6ED4594EC81245511F070CF93D38E8327DBAE01DAE77FE2CF883E1BF02DBF9FE20D6ECF488B8F9EEA50839E95E39E2BFDBA3E13F872E5EDE3D7DB507438696CE06923E99E1B80DF857E44FC6DFDA87C45F15FC617DAC4D72EAD3B800873C28E8AA0F45EBC7BFAF35E637BE24BEBB6324F21127A1351CC68A28FDA7D17FE0A19F0AB51D405ABEA176819B0247B4718FC0673F9D7D0FE14F1A687E38D323D4342D52DB53B47E925BC81B1D8838F43C57F37E3C51756D72243290541E01AF40F03FED07E28F0AAAFF00676B779A7AB6372DBCE50363A671D69A629247F435457E4BFC0AFF00829AF8BBC23750D8F89957C4BA306084C8DFE928381F2B700E064E0F5279615FA83F0E7E23685F153C2765E21F0EDF477DA7DD26E0C87943DD587620E4107B823A83546674F45145001451450014514500725F14FC7F6BF0D7C15A86B9718668576C31E09DF21E1471CF523E95F88BFB5DFC6BD53C7BE38B9D345EB496E2569272AC486978CF5CF0325473D00AFD32FF008284F8B64F0E78174F283634024B88A60791211E5018FA3B1CFF00B3EFC7E2DDCB49A86BD2DD4ADB839258FBD06B15A5C8F47B059B500255DD1440FE7D457470786AE7C44F34E887CB53803B673FFEBAB3A0E9C8CC65FE191C91EFB719CFE62BE81F843E064BED15CBC7804EE620756E4D72D49F29DD42973BD4F9A75CF87F2D9A67C9C03B874EE3FF00D75CDFF614D05A6FD98208AFB1FC69E00FF419DC47F71B9E3A67FF00D55E2F77E1957B4D4004C988E547B63BFE34A9D4E62EB61D4763CB346592DE75206057DC3FB0C7ED2577F067C57158DF1F3FC37AA34705CA4926D5B639C09864E00E46EEF800FF000E0FC9F65A046D1065E4E4015DEF876CD74FC2E76902BACE1E45B1FBD904F1DD411CD13078A450E8C3B82320D495E71FB3B78E3FE161FC1AF0BEB2ECAD3C96891CFB136A891400C003CE074AF47A0C1E8145145020A28A2803F3EBFE0AAFADCD6965E17D391888AE6DE67603A121D71FCEBF2AE0F96FFECE3F88F22BF587FE0AA5A6452E81E18BF6602584BC6A33CE1B24FF002AFCFEF815F0A6DBC77E2796EEF33F6580F3F2E41C8CFF004AC673E53BE8C39D2456F04F8764D4A6B6B58532D8DAD91C0F98135F6D7C1EF87125B6952C2C814123695E7B562E89F0EFC25A35EAAD9BD9DBCD90A373AA924FE35EBBE18D44F878450ACD1491391B5A19030C7D4579B52AA923DAA145C4E7B52F85371A826A36F247F23C83693E81473F9E6BE7CF137C13D5349F145EE9F0401E0B9B770181E0904100D7DEF73209749372FF00708CE6BCDB53B9B092EFCC5B845949EEC01FE759D1A963A2B53BA3F3A75BF07EA5E0FD45ACAFADDA374607804AF503AFE35AFAFE9D368ABA54CEBB7ED5117FAFCD8AFBE2FF00E177873C7D69E6DE4105ECDD3CD5C3FF00235E03FB587C3EB3F0C68BA3CD6D1ED16A161185C705EBB156F7AC79B3C3DA373ED7FD822E0DC7ECE1A3B13902F2E947D04840AFA26BE6FF00F827DFFC9B5691FF005FD77FFA34D7D215E82D8F0E7F130A28A282028A28A00FCEBFF829A7DA355D621B779CFD9AC6D11A288E3EFBE7F9E2BCBFF67CF865359F815110B41777015E4651CF2B5EC7FF000506D02EAF7E23E871BC2DF62D485BA6FECCB1B92FF88C8FCEA7F8632C305A43144020181815E4D7A966E27D261292718C91C4DEFECDC9AB4703DC5C48B7915C2DC0BA0A0B9DBCE3E99AEC2C7C250786CDB58C0B8890A058F180A157071F53F37D6BD52E67108241AE0753D54DCEB84C618B236D638E335C4E5EED8F5542CEE7AB2446F3C2EB6EA3700B8C7E75E21E3BF8263C6B6FF626964B097ED092ADC44A0B28539C0CF635EDDE1D9A48B4F4DC0F4C9C0AD278E39CA4AA0EEC73918ACD3E535B5CF3DF02FC2F9BC136F1A5ADFDC3C423546898E549031BBDB3D702B80FDAF3C2736BBF0DE7788169E0962918FA287E7F9D7D2B6411A2F9B35C37C56D2E3D6740BFB05E5AE2268D7EA4103F9D5465EF5C8A90F72C43FF0004E8FB545F08752B5B8C8105E85404F405013F4C924FD4D7D5D5F38FEC3FA74D67F0E75496542A971781938E080801C7E208AFA3ABE869BBC133E3310AD564828A28AD0E70A28A2803CDBE3B7C288BE2A7851208D51755B193ED1672BE786008238F5048F6CE706BE2DD0EF24F0E6B373692831BC3298D949E854E08FCEBF46EBF3CBE37D8C5A0FC5DF10DADAC663812E8B05249E58063F99626BCBC64169347B997557AD37EA77D1EB90DED9B96970DB4E3EB8AE1351D0FC41ADF94345D4069938B959A494C61C4CA060A907A7D6B951E2B92C14E5B6C63AF356F4AF8C3F67B9115BC6F72CBFC28A58FE95E7C62D9F40A5CC7AFA689E36B9B3B3167AC9D3E582757910AACA9347FC4841C633EB5E85682E1624F3C056239DA735E39A4FC6D7605E5B595557AFC8C6BB6F0FF00C4AB3F125B9F29D95C1C6D618A254DA57365A1D94F7E204214D63C16575E26D622B38159A490F057F87DE9859E5CE7BD76DF082C1CF89DEE021DB1C0C19BD338C7F23451873C9239F113E4A529F63BFF0086BE0A8BE1FF008520D1E220AC6EF271EAC726BA9A28AFA38A514923E1E52739393EA14514532428A2ABDFDFC1A5D94F777522C36F0A179246380A075343692BB0DC835CD7B4EF0CE9373A9EAD7B069DA7DB21926B9B97091C6A3A924F415F9FDF1EFE30F83FE2AFC40BCBEF096A03518AD234B6B895632AA58670549FBC0F3C8AF34FDBFBF68AF137C4DD44F873453359F866DD89585090D70E0E37C8470474214F4EA79C6DF9F7F655B7B856F11C376087F39011E842B7F8D78F5B110AD1B5369A3DAC2509D3973491F434A21BEB72B27CD9ED4EF0FF00876DACEED678ECD64C1CF439AC2B8B9974EBC28C0AC7D8FB57A2780B53B698C67CC19AE0551C5D8F7E0F94ECB44956F4EC7B49103F5050E2BAFD0FC3561A5CC648ACA357639DC07357B48BEB730852E326A5BED4A0B66DB1B067EC16AE755B46AE573685D24719DEC148EEC718AF6AF859A0AE9FA125FB36F9EF143643646CED8FF3FD2BE39F8E7AEEA7A17C2AD6EF6D199752687CBB731F2448C700D6CFEC21FB596A1E2EB6B7F03F8C18FF006944365A5CB8D848001D8D9C64F5C11D873C8CB6B849C215173BDF63CAC7FB49526A1B753EE3A28A2BDF3E5828A28A002BC57F68BF1908B468F41B2B85335C1DF70636E550745383C64FE6335F377C4CFDA27C57E31BBB7B237FF638C4BF245A71687249C0C90C4903EB57E259C5B2ACB2BCCF8F9A476CB31F526BF38CE388554A0E96197C5D5F6F43E8F0B97384D4EA3DBA1E67E2DF025B6AECCEF08673DF15E4FE03F0AA7857C77E20B455D86796398718CAE08FE60D7D392DAEF43C73F5AF2EF16E8CDA778F34BBF45F92E2268256FF006865947FE855F3794E612F6DC937A1EDCA9D95C9F56F0D45A9DA92C3200C74AC0D2FC23796B70B1D8DC4B08EC170057A8E9D622646848EDD29F65A4CB6F788116BEF62B99DD9CFB117873C31AE244A66D46723D322BD23C3FE1D08AB24D99641C6F6EB4DD1619B6A875C574535D0D3ED99C9C2AFAD6BA5EC52671BF122D22BB4B2D39B6B79B26ED87BA8073FD2BC83C47F0F61F0BF88EDF5FD2A336D7492872F17CA7EF039CFE15D5E93E29FF84DFE23EB6E18BDBE94EB691E7A0620B3E3F351F8575DAFD90BDB768FA8E82BF3FCCB1952962DA8BD8E9504D5CFA9BE10F8EE2F1BF8234CBB9668FEDDE52A4D18201DD81CE33C67FC2BB8AF853C297D75A3DBC96A933C0F138F24C6C54EDC73C8AF4AF0C7C5DF10E808B18B91776F904C773F39C679C375FE75F5583E29A768D3C445EDBAFF0023E7EBE56DB72A4FE47D434579269DFB4369C621FDA1A65D47260E7ECBB5C7FE3C4515F491CEF2F92BFB64798F05884EDC87C25E03D3E4D47597D5668FCC485F11EE1D18F7FC39AF5E8DCA2ED2D9ACBD1F488745B28ED6DF8445C138C6E3DCFE35711B68AFC26B54E73EDA28BD1A6EAE77C67A38BDB3899577491CE922FB1CE0FE84D6FDBB938A9AE2212A303E86AB09250AD193EE8A9EC640B76B3BEB29E318B79BE576FF0068F4AE86FACDECEE9645076F6C53F44D3A3D56C12DE5242210E31EA39AED6CF458AEEDC1918B11C722BF60E6D74381A397D3B5191EE114E707D6B3FE206AB2D9D85C8C911A46C5BEA01AE926D3A3B7F115BC2BC288D8FE55E7FF001A2EDEDF4C9517A4D32C6C7D89C1ACEACF91391518A3CFFE03E9173A7E87717B79FF001F5A85CC974CDD49DCC71F90C57B129DFD6B9BF0B5AA5B59C30A0F910002BA60814D7E4D89AEEB579CDF73B52D0CABDB7115F24EA0E47CBF81AB514803B2E78CF149784B315ED8CD508E66DD19F519AC94985AE6BE45151F9A68A7CCCAE547FFD9");
        StringBuilder stringBuffer = new StringBuilder();
        stringBuffer.append("data:image/jpeg;base64,");
        stringBuffer.append(Base64.encodeBase64String(bytes));
        System.out.println(stringBuffer.toString());
    }
}
